package jpa.entitys.promis.sales;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the CONTRACT_INSTALLMENTS database table.
 * 
 */
@Embeddable
public class ContractInstallmentPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(name="TYPE_OF_CONTRACT", unique=true, nullable=false, length=2)
	private String typeOfContract;

	@Column(name="CONTRACT_SERIES", unique=true, nullable=false, length=4)
	private String contractSeries;

	@Column(name="CONTRACT_NUMBER", unique=true, nullable=false, precision=6)
	private long contractNumber;

	@Column(name="REVISION_NUMBER", unique=true, nullable=false, precision=3)
	private long revisionNumber;

	@Column(name="INSTALLMENT_SEQ", unique=true, nullable=false, precision=8)
	private long installmentSeq;

	@Column(name="PAYMENT_TYPE", unique=true, nullable=false, length=1)
	private String paymentType;

	@Column(name="INSTALLMENT_NUMBER", unique=true, nullable=false, precision=5)
	private long installmentNumber;

    public ContractInstallmentPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getTypeOfContract() {
		return this.typeOfContract;
	}
	public void setTypeOfContract(String typeOfContract) {
		this.typeOfContract = typeOfContract;
	}
	public String getContractSeries() {
		return this.contractSeries;
	}
	public void setContractSeries(String contractSeries) {
		this.contractSeries = contractSeries;
	}
	public long getContractNumber() {
		return this.contractNumber;
	}
	public void setContractNumber(long contractNumber) {
		this.contractNumber = contractNumber;
	}
	public long getRevisionNumber() {
		return this.revisionNumber;
	}
	public void setRevisionNumber(long revisionNumber) {
		this.revisionNumber = revisionNumber;
	}
	public long getInstallmentSeq() {
		return this.installmentSeq;
	}
	public void setInstallmentSeq(long installmentSeq) {
		this.installmentSeq = installmentSeq;
	}
	public String getPaymentType() {
		return this.paymentType;
	}
	public void setPaymentType(String paymentType) {
		this.paymentType = paymentType;
	}
	public long getInstallmentNumber() {
		return this.installmentNumber;
	}
	public void setInstallmentNumber(long installmentNumber) {
		this.installmentNumber = installmentNumber;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof ContractInstallmentPK)) {
			return false;
		}
		ContractInstallmentPK castOther = (ContractInstallmentPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.typeOfContract.equals(castOther.typeOfContract)
			&& this.contractSeries.equals(castOther.contractSeries)
			&& (this.contractNumber == castOther.contractNumber)
			&& (this.revisionNumber == castOther.revisionNumber)
			&& (this.installmentSeq == castOther.installmentSeq)
			&& this.paymentType.equals(castOther.paymentType)
			&& (this.installmentNumber == castOther.installmentNumber);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.typeOfContract.hashCode();
		hash = hash * prime + this.contractSeries.hashCode();
		hash = hash * prime + ((int) (this.contractNumber ^ (this.contractNumber >>> 32)));
		hash = hash * prime + ((int) (this.revisionNumber ^ (this.revisionNumber >>> 32)));
		hash = hash * prime + ((int) (this.installmentSeq ^ (this.installmentSeq >>> 32)));
		hash = hash * prime + this.paymentType.hashCode();
		hash = hash * prime + ((int) (this.installmentNumber ^ (this.installmentNumber >>> 32)));
		
		return hash;
    }
}